<template>
	<view class="container" :class="'theme-'+theme" id="container">
		<!-- <scroll-view style="padding-bottom: 50px;"> -->
		<view class="card-bc" style="">
			<view class="mp-search-box themeBgColor">
				<view class="addressBox">
					<view style="margin: 10px;" @click="navTo('/pages/address/address')">
						<view class="iconfont icon-addressfill" style="font-size: 20px;color:#FFFFFF"></view>
						<view class="icontext" > 
							地址
						</view>
					</view>
					<view style="color:#FFFFFF;font-size: 18px;">我的</view>
					<view style="margin-right: 10px;" @click="navTo('/pages/message/message')">
						<view class="iconfont icon-message" style="font-size: 18px;color:#FFFFFF"></view>
						<view class="icontext" >
							信息
						</view>
					</view>
				</view>
				
			</view>
			<view class="user-section">
				<!-- <image class="bg" src="/static/newh5/bc.png"></image> -->
				<view class="bg"></view>
				<view class="user-info-box">
					<view class="portrait-box">
						<image @click="navTo('/pages/user/info')" class="portrait"
							:src="userInfo.avatarPath || '/static/newh5/missing-face.png'"></image>
					</view>
					<view class="info-box">
						<text @click="navTo('/pages/user/info')" class="username">{{userInfo.userName || '游客'}}</text>
					</view>
					<view  style="flex: 1;text-align: right;margin-bottom:80rpx ;" @click="navTo('/pages/set/set')">
						<image src="../../static/newh5/设置.png" style="width: 22px;height: 22px;"></image>
					</view>
				</view>
				<view class="user-bottom-box">
					<view class="user-bottom-item" @click="navTo('/pages/favorite/favorite')">
						<text>{{collectionNum}}</text>
						<text>收藏夹</text>
					</view>
					<view class="user-bottom-item" @click="navTo('/pages/footpath/footpath')">
						<text>{{footNumber}}</text>
						<text>足迹</text>
					</view>
					<view class="user-bottom-item" @click="navTo('/pages/express/express')">
						<text>{{counts.wayCount}}</text>
						<text>我的快递</text>
					</view>
					<view class="user-bottom-item" @click="navTo('/pages/backlog/backlog')">
						<text>{{unDoworkNum}}</text>
						<text>待办</text>
					</view>
				</view>
				<!-- <view class="vip-card-box"></view> -->
			</view>
		</view>
			<view class="cover-container" :style="[{
				transform: coverTransform,
				transition: coverTransition
			}]" @touchstart="coverTouchstart" @touchmove="coverTouchmove" @touchend="coverTouchend">
				<!-- <image class="arc" src="/static/arc.png"></image> -->

				<!-- 订单+热销商品 -->
				<view class="order-section">
					<view class="order-top" >
						<view >
							<text>我的订单</text>

						</view>
						<view @click="navToOrder('/pages/order/order?state=0')">
							<!-- <image src="../../static/return-icon.png" class="yticon"
								style="width: 18px;height: 18px;transform:rotate(180deg);" mode="aspectFill"></image> -->
								<u-icon name="arrow-right"></u-icon>
						</view>
					</view>
					<view class="border"></view>
					<view class="order-bottom">
						<!-- <view class="order-item" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover" :hover-stay-time="50">
					            <u-icon name="order" class="yticon" color="#fa436a" size="40"></u-icon>
											<text>我的订单</text>
										</view> -->
						<view class="order-item" @click="navToOrder('/pages/order/order?state=1')" hover-class="common-hover"
							:hover-stay-time="50">
							<view class="order-type type1">
								<uni-badge class="badge themeBgColor" :text="counts.waitAudit" size="small"></uni-badge>
							</view>
							<text>审核中</text>
						</view>
						<view class="order-item" @click="navToOrder('/pages/order/order?state=2')" hover-class="common-hover"
							:hover-stay-time="50">
							<view class="order-type type2">
								<uni-badge class="badge themeBgColor" :text="counts.waitSupConfirm" size="small"></uni-badge>
							</view> 
							<text>待接单</text> 
						</view>
						<view class="order-item" @click="navToOrder('/pages/order/order?state=4')" hover-class="common-hover"
							:hover-stay-time="50">
							<view class="order-type type3">
								<uni-badge class="badge themeBgColor" :text="counts.shipped" size="small"></uni-badge>
							</view>
							<text>待收货</text>
						</view>
						<view class="order-item" @click="navToOrder('/pages/evaluate/list')" hover-class="common-hover"
							:hover-stay-time="50">
							<view class="order-type type4">
								<uni-badge class="badge themeBgColor" :text="counts.waitReview" size="small"></uni-badge>
							</view>
							<text>待评价</text>
						</view>
						<view class="order-item" @click="navToOrder('/pages/aftersale/list')" hover-class="common-hover"
							:hover-stay-time="50">
							<view class="order-type type5"></view>
							<text>售后单</text>
						</view>
					</view>
					
				</view>
				
				<view class="order-section">
					<view class="order-hotTitle" >
						<view class="hot-title" >
							<image src="../../static/newh5/hot-item.png" class="yticon"
								style="width: 90px;height: 20px;" mode="aspectFill"></image>
	
						</view>
						<view  style="display: flex;align-items: center;">
							<text style="color: grey;font-size: 12px;">好货超值抢</text>
							<text class="eticon eticon-youjiantou themeTextColor"></text>
							<!-- <view class="hot-title-image"></view> -->
<!-- 							<image src="../../static/newh5/Arrow-Right.png" class="yticon"
								style="width: 15px;height: 15px;margin-top: 8px;" mode="aspectFill"></image> -->
						</view>
					</view>
					
					<view class="order-hot-item" >
						<scroll-view class="hot-list" scroll-x>
							<view class="scoll-wrapper">
								<view v-for="(item, index) in hotGoodsList" :key="index" class="hot-item" @click="navToDetailPage(item)">
									<image 
									style="border: 1px solid #e2e2e2;"
									:src="item.thumbnail!==''?item.thumbnail:item.goodsImageList[0].url===''? errorImgUrl:item.goodsImageList[0].url" 
									mode="aspectFill" @error="item.thumbnail = errorImgUrl"></image>
										<!-- {{item.goodsName}} -->
										<text class="item-title more-t" >{{item.goodsName}}</text>
									<!-- <view v-if="hasLogin" style="display:flex;" class="goodPriceBox">
										<text class="price">￥{{ item.goodsPrice|twoBitMoney }}</text>
										<image class="cartIcon" src="../../static/cart.png" @click.stop="addCart(item)"></image>
									</view> -->
									<view v-if="hasLogin" style="display:flex;" class="goodPriceBox" @click.stop="addCart(item)">
										<view class="priceBox">
											<text class="price">￥{{ item.goodsPrice|twoBitMoney }}</text>
										</view>
										<view class="buyBox">
											<text class="price">抢</text>
										</view>
										<!-- <image class="cartIcon" src="../../static/cart.png" @click.stop="addCart(item)"></image> -->
									</view>
									<view v-else class="price" style="color: #fa436a;">登录查看</view>
								</view>
							</view>
						</scroll-view>
						
					</view>
				</view>
				<!-- <view class="history-title"> -->
				<!-- 	<view class="history-box">
						<text class="eticon eticon-history themeTextColor history-i"></text>
			
						<text style="line-height: 10rpx;">浏览历史</text>
					</view> -->
				<!-- </view>	 -->
				<!-- 浏览历史 -->
				<view class="history-section icon">
					<view class="sec-header" v-if="historyList.length>0">
					<view>
						<image class="image1" src="../../static/his.png" mode=""></image>
						<image class="image2" src="../../static/histitle.png" mode=""></image>
					</view>
						
						<text @click="navTo('/pages/browseHistory/browseHistory')">查看更多</text>
					</view>
					<scroll-view scroll-x class="h-list" v-if="historyList.length>0">
						<view class="scoll-wrapper">
							<view v-for="(item, index) in historyList" :key="index" class="h-item" @click="navToDetail(item)">
								<view class="img-wrapper">
									<image :src="item.goodsImage===''?errorImgUrl:item.goodsImage" mode="aspectFit" @error="item.goodsImage = errorImgUrl"></image>
									<image v-if="item.goodsStatus == 2" class="tag" src="../../static/undercarriage.png"/>
									<image v-if="item.goodsStatus == 3" class="tag" src="../../static/failure.png"/>
								</view>
								<view v-if="hasLogin">
									<text class="price">{{item.goodsPrice===''?'':'￥'+item.goodsPrice}}</text>
								</view>
								<view v-else class="price" style="color: #fa436a;">登录查看</view>
							</view>
						</view>
					</scroll-view>
					<view class="border"></view>
					<view class="my-express" @click="navTo('/pages/express/express')">
						<text class="cell-tit clamp">我的快递</text>
						<text class="cell-more yticon icon-you"></text>
						<!-- <text class="cell-more yticon" class="icon-you"></text> -->
					</view>
					<!-- <view class="my-express" @click="navTo('/pages/wishList/myWishList')">
						<text class="cell-tit clamp">我的心愿单</text>
						<text class="cell-more yticon icon-you"></text>
					</view> -->
					<!-- <list-cell iconImg="../../static/addr.png" iconColor="#5fcda2" title="我的快递" @eventClick="navTo('/pages/express/express')"></list-cell> -->
				</view>
				
			</view>
		<!-- </scroll-view> -->
		<!-- 回到顶部 按钮 -->
		<!-- <view class="backIcon" > -->
			<back-top  :scrollTop='scrollTop' src='../../static/newh5/top.png'></back-top>
		<!-- </view> -->
	</view>
</template>
<script>
	import uniBadge from '../../components/uni-badge/uni-badge.vue'
	import listCell from '@/components/mix-list-cell';
	import backTop from '@/components/back-top/back-top.vue';
	import {
		errorImgUrl
	} from '@/common/utils/config.js';
	import {
		mapState
	} from 'vuex';
	import {
		getHistory,
		getfootHistory
	} from '../../api/public/login.js'
	import {
		getFavoriteList
	} from '../../api/product/list.js'
	import {
		UndoWorkNum,
	} from '@/api/message/message.js'
	import {
		goodsViewHistoryList,
	} from '../../api/history/history.js'
	import {qryConfByItemCode} from '@/api/user/user.js'
	import {queryGoodsLowestPriceById,getCountByStatus,getWaitReviewCount,isBlackPermissionV2,countByShippedStatusV2} from '@/api/order/order.js'
	import {
		addToCart
	} from '../../api/cart/cart.js'
	
	import {
		getCarouselList,
		getQueryHotGoods,
		getFloorInfoWithGoods,
		getFloorInfo,
		getFloorGoods,
		getFloorGoodsForNew,
		getWaitCount,
		countUndoWork,
		queryDefinedHotGood
	} from '@/api/index/index';
	let startY = 0,
		moveY = 0,
		pageAtTop = true;
	export default {
		components: {
			listCell,
			backTop,
			uniBadge
		},
		data() {
			return {
				target:null,
				scrollTop:0,
				count: 0,
				coverTransform: 'translateY(0px)',
				coverTransition: '0s',
				moving: false,
				userInfo: {},
				historyList: [],
				footNumber:0,
				errorImgUrl: errorImgUrl,
				favoriteNum: 0,
				page: 1,
				limit: 10,
				unDoworkNum: 0,
				collectionNum: 0,
				footprintNum: 0,
				//热门商品
				swiperCurrent: 0,
				swiperLength: 0,
				carouselList: [],
				hotGoodsList: [],
				refresh: false,
				// 广州银行-校验商品最低价
				isbuyMinPrice:false,
				counts: {
					waitAudit: 0,
					waitSupConfirm: 0,
					shipped: 0,
					waitReview: 0,
					wayCount: 0
				},
				refresh: false,
				// 广州银行-校验商品最低价
				isbuyMinPrice:false,
			    waitAudit:0,
				'auditedNotProcess':0,
				'waitSupConfirm':0,
				'unShipped':0,
				'shipped':0,
				'waitReview':0,
				"refund": 0,
				isBlack:false,
				endTime:'',
				startTime:''
			}
		},
		onPageScroll(res){
			// console.log(res.scrollTop);//距离页面顶部距离
			this.scrollTop = res.scrollTop

		},
		onLoad() {
			if (this.hasLogin) {
				this.getHistoryList()
				this.getFootNumber()
				this.getUnWork()
				this.getCount()
				this.getConf()
			}
			// this.getFavoriteNum()
		},
		onShow() {
			if (this.hasLogin) {
				countUndoWork().then(res => {
					this.count = res.data
					if (res.data > 0) {
						uni.setTabBarBadge({
							index: 3,
							text: res.data.toString()
						})
					} else {
						uni.removeTabBarBadge({
							index: 3
						})
					}
				})
			}
			if (this.hasLogin) {
				this.userInfo = uni.getStorageSync('userInfo')
				this.getFavoriteNum()
				this.getCollectionNum()
				this.getHistoryList()
				this.getFootNumber()
				this.getUnWork()
			}
			// this.getUnWork()
			//热门商品
			this.loadData();
		},
		onPullDownRefresh() {
			this.refresh = true;
			this.loadData();
			
		
		},
		// #ifndef MP
		onNavigationBarButtonTap(e) {
			const index = e.index;
			if (index === 0) {
				this.navTo('/pages/set/set');
			} else if (index === 1) {
				// #ifdef APP-PLUS
				const pages = getCurrentPages();
				const page = pages[pages.length - 1];
				const currentWebview = page.$getAppWebview();
				currentWebview.hideTitleNViewButtonRedDot({
					index
				});
				// #endif
				uni.navigateTo({
					url: '/pages/notice/notice'
				})
			}
		},
		// #endif
		computed: {
			...mapState(['hasLogin'])
			// ...mapState(['hasLogin', 'userInfo'])
		},
		methods: {
			getCount(){
				getCountByStatus({
					status: 'waitAudit'
				}).then(res => {
					if (res.code === 0) {
						this.counts.waitAudit = Number(res.data)
					}
				})
				
				getCountByStatus({
					status: 'waitSupConfirm'
				}).then(res => {
					if (res.code === 0) {
						this.counts.waitSupConfirm = Number(res.data)
					}
				})
				
				getCountByStatus({
					status: 'shipped'
				}).then(res => {
					if (res.code === 0) {
						this.counts.shipped = Number(res.data)
					}
				})
				
				getWaitReviewCount().then(res => {
					if (res.code === 0) {
						this.counts.waitReview = Number(res.data)
					}
				})
				
				countByShippedStatusV2().then(res=>{
					if(res.code===0){
						this.counts.wayCount = Number(res.data)
					}
				})
			},
			getConf(){
				const deptInfo = uni.getStorageSync('deptinfo')[0]
				qryConfByItemCode({code: "isbuyMinPrice",
					tenant_id: deptInfo.tenantId,
					dept_code: deptInfo.deptCode}).then(res=>{
						if(res.code===0){
							this.isbuyMinPrice = res.data.val == '1'
						}
				})
			},
			// 滚动监听事件处理
			handleAddListenScroll () {
				let _scrollTop = this.getScrollToTop()
				console.log('_scrollTop',_scrollTop);
				// if ( _scrollTop > this.visibilityHeight) {
				// 	this.isShow = true
				// } else {
				// 	this.isShow = false
				// }
			},
			//获取滚动距离
			getScrollToTop () {
				return this.target.scrollTop
			},
			//获取监听滚动的容器
			getContainer () {
				return document.getElementsByClassName('container')[0]
			},
			//点击回到顶部
			backToTop(){
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 300
				});
			},
			//详情页
			navToDetailPage(item) {
				let id = item.goodsId;
				uni.navigateTo({
					url: `/pages/product/product?id=${id}`
				})
			},
			// 点击楼层商品跳转到详情页
			navToFloorItemDetail(good) {
				const id = good.goodsId;
				uni.navigateTo({
					url: `/pages/product/product?id=${id}`
				})
			},
			//添加购物车功能
			addCart(item,isMin = false) {
				if (!this.hasLogin) {
					uni.showModal({
						title: '提示',
						content: '您还未登录，不能进行此操作',
						confirmText: '去登录',
						cancelText: '取消',
						success: (suc) => {
							if (suc.confirm) {
								uni.navigateTo({
									url: '/pages/public/login'
								})
							}
						}
					})
				} else {
					if(this.isbuyMinPrice&&!isMin){
						this.queryLowestPriceGoods(item)
						return
					}
					let pType;
					let qType;
					if (item.goodsSourceType === 0) {
						pType = '02';
						qType = 1;
					} else {
						pType = '01';
						qType = 2;
					}
					var areaId = uni.getStorageSync('areaId')?uni.getStorageSync('areaId'):uni.getStorageSync('enterpriseInfo').areaId;
					let params = {
						num: 1,
						goodsId: item.goodsId,
						areaId: areaId
					};
					addToCart(params).then(res => {
						console.log(params)
						if (res.code === 0) {
							this.$util.msg('加入购物车成功')
						} else if(res.code === 1001) {
						let msg = ''
						if(res.extra.productAvailability) {
							msg = res.extra.productAvailability.filter(item => !item.canPurchase).map(item => item.message).toString()
						}
						this.$util.msg(res.message+' '+msg)
					}else {
							this.$util.msg(res.message)
						}
					})
				}
			},
			queryLowestPriceGoods(item){
				queryGoodsLowestPriceById({goodsId: item.goodsId,purchaserId: uni.getStorageSync('deptinfo')[0].deptId}).then(response=>{
					if(response.code === 0){
					  let res = response.data;
					  if(res.goodsId) {
						  // 返回商品
						  let lowestPrice = Number(res.goodsPrice)
						  if (lowestPrice < item.goodsPrice){
							//不是最低价商品，需要跳转到新商品
							uni.showModal({
								title:'温馨提示',
								content:'商城存在价格更低的同类商品',
								confirmText:'前往购买',
								showCancel:false,
								success(suc) {
									if(suc.confirm){
										uni.navigateTo({
											url:`/pages/product/product?id=${res.goodsId}`
										})
									}
								}
							})
						  } else {
							this.addCart(item,true)
						  }
					  } else {
						this.addCart(item,true)
					  }
					}else{
						this.addCart(item,true)
					}
				})
			},
			//获取热门商品
			async loadData() {
				getCarouselList({
					position: "2"
				}).then(res => {
					if (res.code === 0) {
						// 没设置h5轮播图片的不展示
						this.carouselList = [];
						res.data.forEach(carousel => {
							if (carousel.h5ImgUrl){
								this.carouselList.push(carousel);
							}
						});
						// this.carouselList = res.data;
						this.swiperLength = this.carouselList.length;
					}
				})
				var hotGoods = "1";
				if(uni.getStorageSync('portalSettingsInfo').hotGoods){
					hotGoods = uni.getStorageSync('portalSettingsInfo').hotGoods;
				}
				var hotGoodsArray = [];
				var res = {};
				if (hotGoods == "1"){
					res = await getQueryHotGoods()
				} else {
					res = await queryDefinedHotGood()
				}
				if (res.code !== 0){
					return;
				}
				hotGoodsArray = res.data;
				hotGoodsArray.forEach(goods => {
					if(!goods.goodsPrice){
						goods.goodsPrice = goods.price;
					}
					// if(!goods.goodsImageList||goods.goodsImageList.length===0){
					// 	let img = {
					// 		url:"",
					// 		smallUrl:""
					// 	}
					// 	goods.goodsImageList = [];
					// 	goods.goodsImageList.push(img);
					// }
					if(!goods.thumbnail){
						goods.thumbnail = goods.goodsImageList[0].url
					}
				});
				
				this.hotGoodsList = hotGoodsArray;
				console.log('热销商品',this.hotGoodsList)
			},
			//获取收藏夹个数
			getCollectionNum() {
				const params = {
					page: this.page,
					// limit: 10,
					areaId: uni.getStorageSync('areaId')
				}
				getFavoriteList(params).then(res => {
					if (res.code === 0) {
						this.collectionNum = res.data.goodsList.records[0].length
						// this.favoriteList = this.favoriteList.concat(res.data.goodsList.records[0])
						// this.page += 1;
						// if (this.favoriteList.length === parseInt(res.data.goodsList.total)) {
						// 	this.loadingType = 'noMore'
						// } else {
						// 	this.loadingType = 'more'
						// }
					} else {
						this.$util.msg(res.message)
					}
				})
			},
			// 获取待办事件个数
			getUnWork() {
				const params = {
					bizType: ['order', 'integral']
				};
				UndoWorkNum(params).then(res => {
					if (res.code === 0) {
						// res.data.records.forEach(item=>{
						//   this.todoList.push(item)
						// })
						this.unDoworkNum = res.data
					} else {
						this.toast(res.message)
					}
				})
			},
			navToOrder(url) {
				if (!this.hasLogin) {
					uni.showModal({
						title: '提示',
						content: '您还未登录，不能进行此操作',
						confirmText: '去登录',
						cancelText: '取消',
						success: (suc) => {
							if (suc.confirm) {
								uni.navigateTo({
									url: '/pages/public/login'
								})
							}
						}
					})
				} else {
					isBlackPermissionV2({ apiUrl: 'jumpMenu?permId=10004'}).then(res => {
						if(res.code == 0) {
							this.isBlack = res.data
							if(this.isBlack =='inBlackList') {
								uni.showModal({
									title: '系统提醒',
									content: '很抱歉，您已被限制无法使用该功能。如需解除，您可通过发起申请，待平台方审批通过后方可恢复权限。',
									confirmText: '确定',
									showCancel: false,//没有取消按钮的弹框
									success: (suc) => {
										
									}
								})
							}else {
								uni.navigateTo({
									url
								})
							}
						}
					})
					
					
				}
			},
			/**
			 * 统一跳转接口,拦截未登录路由
			 * navigator标签现在默认没有转场动画，所以用view
			 */
			navTo(url) {
				if (!this.hasLogin) {
					uni.showModal({
						title: '提示',
						content: '您还未登录，不能进行此操作',
						confirmText: '去登录',
						cancelText: '取消',
						success: (suc) => {
							if (suc.confirm) {
								uni.navigateTo({
									url: '/pages/public/login'
								})
							}
						}
					})
				} else {
					
								uni.navigateTo({
									url
								})
							
					
					
				}
			},

			getFavoriteNum() {
				const params = {
					page: 1,
					limit: 5,
					areaId: uni.getStorageSync('areaId')
				}
				getFavoriteList(params).then(res => {
					if (res.code === 0)
						this.favoriteNum = res.data.goodsList.total
				})
			},
			navToFavorite() {
				uni.navigateTo({
					url: `/pages/favorite/favorite`
				})
			},
			getStartTime() {
				const date = new Date()
				const year = date.getFullYear()
				const month = date.getMonth() + 1
				const day = date.getDate()
			
				const date1 = new Date(date - 1000 * 60 * 60 * 24 * 30)
				const year1 = date1.getFullYear()
				const month1 = date1.getMonth() + 1
				const day1 = date1.getDate()
				this.startTime = year1 + "-" + (month1 < 10 ? "0" + month1 : month1) + "-" + (day1 < 10 ? "0" + day1 :
					day1) + ' 00:00:00' // 30天前的日期
				this.endTime = `${year}-${month+1}-${day}` + ' 23:59:59' // 当天的日期
			},
			getHistoryList() {
				this.getStartTime()
				let param = {
					page: 1,
					limit: 500,
					endTime: this.endTime,
					startTime: this.startTime
				}
				goodsViewHistoryList(param).then(res => {
					if (res.code === 0) {
						this.historyList = res.data.records
						console.log(this.historyList)
					}
				})
			},
			//获取足迹数量信息
			getFootNumber() {
				getfootHistory().then(res => {
					if (res.code === 0) {
						this.footNumber = res.data
						console.log('足迹数量',this.footNumber);
					}
				})
			},
			navToDetail(item) {
				if(item.goodStatus != 1) return
				let id = item.goodsId;
				uni.navigateTo({
					url: `/pages/product/product?id=${id}`
				})
			},
			/**
			 *  会员卡下拉和回弹
			 *  1.关闭bounce避免ios端下拉冲突
			 *  2.由于touchmove事件的缺陷（以前做小程序就遇到，比如20跳到40，h5反而好很多），下拉的时候会有掉帧的感觉
			 *    transition设置0.1秒延迟，让css来过渡这段空窗期
			 *  3.回弹效果可修改曲线值来调整效果，推荐一个好用的bezier生成工具 http://cubic-bezier.com/
			 */
			coverTouchstart(e) {
				if (pageAtTop === false) {
					return;
				}
				this.coverTransition = 'transform .1s linear';
				startY = e.touches[0].clientY;
			},
			coverTouchmove(e) {
				moveY = e.touches[0].clientY;
				let moveDistance = moveY - startY;
				if (moveDistance < 0) {
					this.moving = false;
					return;
				}
				this.moving = true;
				if (moveDistance >= 80 && moveDistance < 100) {
					moveDistance = 80;
				}

				if (moveDistance > 0 && moveDistance <= 80) {
					this.coverTransform = `translateY(${moveDistance}px)`;
				}
			},
			coverTouchend() {
				if (this.moving === false) {
					return;
				}
				this.moving = false;
				this.coverTransition = 'transform 0.3s cubic-bezier(.21,1.93,.53,.64)';
				this.coverTransform = 'translateY(0px)';
			}
		}
	}
</script>
<style lang='scss'>
	%flex-center {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
	.history-box{
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 20rpx;
		.history-i{
			font-size: 41rpx;
			margin-left: 0;
			margin-right: 20rpx;
		}
	}
	%section {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-around;
		align-content: center;
		background: #fff;
		border-radius: 10upx;
	}

	page,
	.container {
		background-color: #f5f5f5;
	}

	.border {
		margin: 0 30rpx;
		border-top: 1rpx solid $border-color-base;
	}
	.mp-search-box {
		position: sticky;
		left: 0;
		top: 0;
		z-index: 9999;
		width: 100%;
		height: 80rpx;
		// padding: 20rpx 30rpx;
		text-align: center;
		display: flex;
		flex-direction: column;
		/* background-color:rgba($color: #F7F7F7 , $alpha: 0.8) ; */
		.searchBox{
			display: flex;
			align-items: center;
			padding: 10rpx;
			justify-content: space-around;
			// margin-top: 90rpx;
			background-color:#E8E8EB ;
			.inputBox{
				display: flex;
				background: #fff;
				height: 68rpx;
				width: 98%;
				border-radius: 5px;
				&::before {
					content: " ";
					display: inline-block;
					width: 33rpx;
					height: 33rpx;
					position: relative;
					top: 18rpx;
					left: 305rpx;
					background: url(../../static/search-icon.png) no-repeat;
					background-size: contain;
				}
			}
			
			
		}
		.addressBox{
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 90rpx;
			width: 100%;
			// background: #f0f0f0 ;
			// background-color:rgba($color: #D3D3D3, $alpha: 0.6) ;
			z-index: 9999;
			
			
		}
		.icontext{
			font-size: 10px;color:#eee;
		}
		.ser-input {
			width: 100%;
			height: 70rpx;
			line-height: 60rpx;
			text-align: center;
			font-size: 28upx;
			color: #909090;
			border-radius: 5px;
			// background: #f0f0f0;
			// background: #fff;
		}
	
		.search {
			width: 40rpx;
			height: 40rpx;
			margin-top: 10rpx;
		}
	
		.ph {
			text-align: center;
			font-size: 28upx;
			color: $font-color-base;
		}
	}
	.card-bc{
		/* background-image: linear-gradient(to bottom , #3fc7a8,#eee); */
		/* background-image: linear-gradient(to bottom , #00B48D ,rgba(0,180,141,0)); */
		
	}
	.user-section {
		background-image: linear-gradient(to bottom , #00B48D ,rgba(0,180,141,0));
		/* background-image: linear-gradient(to bottom , #3fc7a8,#eee); */
		height: 400upx;
		padding: 40upx 30upx 0;
		position: relative;
		
		.bg {
			position: absolute;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			background-image: url(../../static/newh5/bc.png);
			background-size: contain;
			background-repeat: no-repeat;
			/* filter: blur(1px); */
			/* opacity: .9; */
		}
	}

	.user-bottom-box {
		display: flex;
		position: relative;
		justify-content: space-around;
		align-items: center;
		margin-top: 30rpx;
		z-index: 1;
		color: white;
		padding: 15rpx;
		color: #646464;
		.user-bottom-item {
			display: flex;
			flex-direction: column;
			text-align: center;
			line-height: 50rpx;
		}
	}

	.user-info-box {
		/* height: 135upx; */
		display: flex;
		align-items: center;
		position: relative;
		z-index: 1;
		padding:20rpx 30rpx 0 30rpx;

		.portrait {
			width: 120upx;
			height: 120upx;
			border: 5upx solid #fff;
			border-radius: 50%;
		}

		.username {
			font-size: $font-lg + 2upx;
			color: $font-color-dark;
			margin-left: 20upx;
		}
	}

	.vip-card-box {
		display: flex;
		flex-direction: column;
		color: #f7d680;
		height: 240upx;
		background: linear-gradient(left, rgba(0, 0, 0, .7), rgba(0, 0, 0, .8));
		border-radius: 16upx 16upx 0 0;
		overflow: hidden;
		position: relative;
		padding: 20upx 24upx;

		.card-bg {
			position: absolute;
			top: 20upx;
			right: 0;
			width: 380upx;
			height: 260upx;
		}

		.b-btn {
			position: absolute;
			right: 20upx;
			top: 16upx;
			width: 132upx;
			height: 40upx;
			text-align: center;
			line-height: 40upx;
			font-size: 22upx;
			color: #36343c;
			border-radius: 20px;
			background: linear-gradient(left, #f9e6af, #ffd465);
			z-index: 1;
		}

		.tit {
			font-size: $font-base+2upx;
			color: #f7d680;
			margin-bottom: 28upx;

			.yticon {
				color: #f6e5a3;
				margin-right: 16upx;
			}
		}

		.e-b {
			font-size: $font-sm;
			color: #d8cba9;
			margin-top: 10upx;
		}
	}

	.cover-container {
		background: $page-color-base;
		/* margin-top: -125upx; */
		padding: 0 30upx;
		position: relative;
		background: #f5f5f5;
		padding-bottom: 20upx;

		.arc {
			position: absolute;
			left: 0;
			top: -34upx;
			width: 100%;
			height: 36upx;
		}
	}

	.tj-sction {
		@extend %section;

		.tj-item {
			@extend %flex-center;
			flex-direction: column;
			height: 140upx;
			font-size: $font-sm;
			color: #75787d;
		}

		.num {
			font-size: $font-lg;
			color: $font-color-dark;
			margin-bottom: 8upx;
		}
	}

	.order-section {
		@extend %section;
		padding: 20upx 20upx;
		margin-top: 20upx;
		border: 1px solid $my-border-color-grey;
		.order-hotTitle {
			display: flex;
			justify-content: space-between !important;
			align-items: center;
			width: 100%;
		}
		.order-top {
			display: flex;
			justify-content: space-between;
			width: 100%;
			/* margin: 15rpx; */
			margin-bottom: 15rpx;
		}
		
		.hot-title-image{
			margin-left: 10rpx;
			width: 28rpx;
			height: 28rpx;
			background-image: url(../../static/newh5/Arrow-Right.png);
			background-size: contain;
			background-repeat: no-repeat;
		}
		
		.order-item {
			@extend %flex-center;
			width: 140upx;
			height: 140upx;
			border-radius: 10upx;
			font-size: $font-sm;
			color: $font-color-dark;
			
			.order-type{
				width: 41rpx;
				height: 36rpx;
				margin-bottom: 18rpx;
				position: relative;
				&.type1{
					height: 41rpx;
					background-size: contain;
					background-repeat: no-repeat;
				}
				&.type2{
					background-size: contain;
					background-repeat: no-repeat;
				}
				&.type3{
					background-size: contain;
					background-repeat: no-repeat;
				}
				&.type4{
					background-size: contain;
					background-repeat: no-repeat;
				}
				&.type5{
					background-size: contain;
					background-repeat: no-repeat;
				}
				/deep/.uni-badge{
						line-height: normal;
						display: flex;
						align-items: center;
						justify-content: center;
					}
				
				.badge {
					position: absolute;
					top: -16upx;
					left: 40upx;
					color: #fff;
					background-color: $base-color;
					/* #ifdef MP */
					border-radius: 100px;
					/* #endif */
				
					text {
						/* #ifdef MP */
						color: #fff;
						background-color: $base-color;
						/* #endif */
					}
				}
			}
		}

		.order-bottom {
			display: flex;
			width: 100%;
			border: 1px solid $my-border-color-grey;
			border-radius: 15rpx;
		}
		.order-hot-item{
			width: 100%;
			/* border: 1px solid $my-border-color-grey; */
			border-radius: 15rpx;
			
			.goodPriceBox{
				display: flex;
				justify-content: space-between;
				background-image: linear-gradient(to right ,#FD8D3C ,#F5212D );
				// color: white;
				// border-radius: 12px;
				border-top-left-radius: 12px;
				border-bottom-left-radius: 12px;
				padding: 4rpx;
				
				.priceBox{
					font-family: PingFangSC-Medium;
					// background-image: linear-gradient(to right ,#FD8D3C ,#F5212D );
				}
				.price{
					color: white;
					font-size: $my-font-size-middle;
				}
				.buyBox{
					font-family: PingFangSC-Medium;
					width: 40rpx;
					background-image: linear-gradient(to right ,#FD8D3C ,#F5212D );
					// background: linear-gradient(-60deg, transparent 15px, #FD8D3C 0);
				}
			}
			
			
		}
		.hot-title{
			margin-top: 20rpx;
			
			
		}
		
		.yticon {
			font-size: 48upx;
			margin-bottom: 18upx;
			color: #fa436a;
		}

		.icon-shouhoutuikuan {
			font-size: 44upx;
		}
		.hot-list {
			white-space: nowrap;
		}
		.scoll-wrapper {
			display: flex;
			flex: row wrap;
			align-items: flex-start;
			
			.item-title {
				line-height: 30rpx;
				height: 60rpx;
				text-align: left;
				color: $font-color-dark;
				font-size: $my-font-size-base;
				margin: 10rpx 0;
				white-space: normal
				// overflow: hidden;
				// text-overflow: ellipsis;
			}
			.more-t {
				overflow: hidden; // 超出的文本隐藏
				word-break: break-all;
				text-overflow: ellipsis; // 溢出用省略号显示
				display: -webkit-box; // 将对象作为弹性伸缩盒子模型显示。
				-webkit-line-clamp: 2; // 这个属性不是css的规范属性，需要组合上面两个属性，表示显示的行数。
				-webkit-box-orient: vertical; // 从上到下垂直排列子元素（设置伸缩盒子的子元素排列方式）
				transition: all linear 0.2s;
			}
			
			
		}
		.history-title{
			display: flex;
			justify-content: center;
			align-items: center;
			margin-top: 20rpx;
			
		}
		.hot-item {
			width: 200upx;
			// width: 30%;
			margin-right: 20upx;
			font-size: $font-sm+2upx;
			color: $font-color-dark;
			// line-height: 1.8;
			text-align: center;
			display: flex;
			flex-direction: column;
		
			image {
				width: 185upx;
				height: 185upx;
				border-radius: 6upx;
			}
		
			.integral {
				width: 160rpx;
				color: $uni-color-primary;
				font-size: 15px;
				margin: 4rpx 4rpx 0 4rpx;
		
				&:before {
					background: url(../../static/money.png) no-repeat;
					width: 22rpx;
					height: 22rpx;
					margin-right: 4rpx;
					display: inline-block;
					content: '';
					background-size: contain;
				}
		
				&:after {
					margin-left: 4rpx;
					content: '积分';
					color: #909090;
					font-size: 12px;
				}
			}
		
			.price {
				width: 160rpx;
				color: $uni-color-primary;
				font-size: 15px;
				margin: 4rpx 4rpx 0 4rpx;
			}
			.cartIcon{
				width: 50rpx;
				height: 50rpx;
				// margin-top: 15rpx;
			}
		}
		
	}
	.backIcon{
		position: fixed;
		display: flex;
		flex-direction: row-reverse;
		z-index: 999;
		bottom: 50px;
		width: 90%;
		height: 70rpx;
		.cycle{
					border-radius: 40%;
					width: 25px;
					height: 25px;
					background-color:#f8f8f8;
					display: flex;
					justify-content: center;
					align-items: center;
	}
	}

	
	.history-section {
		/* padding: 30upx 0 0; */
		margin-top: 20upx;
		background: #fff;
		border-radius: 10upx;

		.sec-header {
			padding-top: 30rpx;
			display: flex;
			align-items: center;
			font-size: $font-base;
			color: $font-color-dark;
			line-height: 40upx;
			margin-left: 30upx;
			padding-right: 30rpx;
			justify-content: space-between;
			.image1 {
				width: 39rpx;
				height: 39rpx;
				margin-right: 10rpx;
			}

			.image2 {
				width: 122rpx;
				height: 28rpx;
			}

			/* .yticon {
				font-size: 44upx;
				color: #5eba8f;
				margin-right: 16upx;
				line-height: 40upx;
			} */
		}

		.b:after {
			position: relative;
			z-index: 3;
			left: 90upx;
			right: 30upx;
			height: 0;
			content: '';
			transform: scaleY(.5);
			border-bottom: 1px solid $border-color-base;
		}

		.h-list {
			white-space: nowrap;
			padding: 20upx 30upx;

			image {
				display: inline-block;
				width: 160upx;
				height: 160upx;
				margin-right: 20upx;
				border-radius: 10upx;
			}
		}

		.scoll-wrapper {
			display: flex;
		}

		.h-item {
			min-width: 160upx;
			margin-right: 20upx;
			font-size: $font-sm+2upx;
			color: $font-color-dark;
			line-height: 1.8;
			text-align: center;
			display: flex;
			flex-direction: column;
			align-items: center;
			
			.img-wrapper{
				position: relative;
				image {
					width: 160upx;
					height: 160upx;
					border-radius: 6upx;
					margin-right: 0!important;
				}
				.tag{
					position: absolute;
					width: 120rpx;
					height: 120rpx;
					left: 20rpx;
					top: 20rpx;
				}
			}
			
			.integral {
				width: 160rpx;
				color: $uni-color-primary;
				font-size: 14px;
				margin: 4rpx 4rpx 0 4rpx;

				&:before {
					background: url(../../static/money.png) no-repeat;
					width: 20rpx;
					height: 20rpx;
					margin-right: 4rpx;
					display: inline-block;
					content: '';
					background-size: contain;
				}

				&:after {
					margin-left: 4rpx;
					content: '积分';
					color: #909090;
					font-size: 11px;
				}
			}

			.price {
				display: block;
				color: #646464;
				font-size: 13px;
			}
		}
	}
	.my-express {
		padding: 30upx;
		display: flex;
		justify-content: space-between;
	}
</style>
